<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="css/user.css" rel="stylesheet">
        <title> Προφίλ</title>
        <?php
            session_start();
            include_once 'Classes/UserUtils.class.php';
            include 'Classes/TripsTemplate.class.php';
            $userId = UserUtils::getUserId();
        ?>
    </head>
    <body>
        <div id="bodycolor">
        <div class="left">
            <img src="http://www.gravatar.com/avatar/<?= UserUtils::getGravatarHash($userId) ?>">
            <?= UserUtils::getFollowButton($userId); ?>
            <form action="updateLocation.php">
            <label for="currentLocation">
                Τρέχουσα τοποθεσία:
            </label>
            <?php
                if(strlen(UserUtils::getCurrentLocation($userId)) == 0)
                    $curLocation = 'Η τοποθεσία μου';
                else
                    $curLocation =  UserUtils::getCurrentLocation($userId);
            ?>
            <input type="text" name="currentLocation" autocomplete="off" size="20" value=" <?= $curLocation ?>">
            <?php
                if(isset($_SESSION['userId'])){
                    if($userId == $_SESSION['userId'])
                        echo '<input type="submit" value=" Αλλαγή ">';
                }
            ?>
            </form>
            <p> Followers: <?= UserUtils::getFollowersCount($userId) ?></p>
            <p> Following: <?= UserUtils::getFollowingsCount($userId) ?></p>
            <a href="index.php" class="link"> Aρχική σελίδα </a>
            <a href="follow.php" class="link"> Άτομα που ακολουθείτε </a>
            <a href="logout.php" class="link"> Αποσύνδεση </a>
        </div>
        <div id="trips" class="right">
            <a href="#past">Παλιά ταξίδια</a>
            <a href="#future">Νέα ταξίδια</a>
            <div id="past">
                <div class="trips">
                    <?php
                        $tripshtml = new TripsTemplate();
                        $tripshtml(UserUtils::getPastTrips($userId));
                    ?>
                </div>
            </div>
            <div id="future">
                <div class="trips">
                    <?php
                        $tripshtml = new TripsTemplate();
                        $tripshtml(UserUtils::getFutureTrips($userId));
                    ?>
                </div>
            </div>
        </div>
            <div class="clear"></div>
        </div>
    </body>
</html>
